//
// Created by 98770 on 2023/6/22.
//

#ifndef NETWORK_ISPQUERY_H
#define NETWORK_ISPQUERY_H

#define MAX_RETRIES 3
#define TIMEOUT_SEC 5
#if _WIN32

#include <winsock2.h>

#pragma comment(lib, "ws2_32.lib")

#else

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/select.h>
#include <errno.h>
#endif

#include <unistd.h>
#include <stdio.h>
#include "libCache.h"
#include "serverControl.h"


extern char* getDomainName(char*packet,int len);
struct DNS_answer* resolveQueryOnISP(char *buff,int len,char *DNSserver);
//以下函数只取返回包第一条记录
struct DNS_answer* getAnswer(char* packet,int len);

uint16_t assignQueryID(char *packet,struct sockaddr_in* si_in);
uint16_t recoverQueryID(char* packet,struct sockaddr_in* si_in);
#endif //NETWORK_ISPQUERY_H
